/* "Ready When the Big One Comes? Natural Disasters and Mass Support for Preparedness Investment"

Michael M. Bechtel
Massimo Mannino

First version: Dec 16, 2019
https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3494976

********** DATA CITATION DISCLAIMER **************
Use of this replication archive (in full or in part) is subject to data citation principles. 

Data Citation Synthesis Group: Joint Declaration of Data Citation Principles. Martone M. (ed.) San Diego CA: FORCE11; 2014 https://doi.org/10.25490/a97f-egyk 
**************************************************
*/

version 13      
set more off 
clear all
capture log close

* Change to own working directory
global path="/Users/mbechtel/Desktop/Dropbox/Disaster policy/02 Empirics/10 Replicationarchive"

use  "$path/main_touse_clean.dta"

log using "$path/logfile_01.smcl", replace


**********************************************************************
* Prepare additional covariates and information about key dependent vars
**********************************************************************

* Create age groups variable
gen agegroups=.
replace agegroups=1 if (age > 17 & age <25)
replace agegroups =2 if (age > 24 & age < 45)
replace agegroups =3 if (age > 44 & age < 65)
replace agegroups =4 if (age > 64 & age < 150)

lab define agegr_lab 1 "Age: 18-24" 2 "Age: 25-44" 3 "Age: 45-64" 4 "Age: 65+"
lab values agegroups agegr_lab
tab agegroups

* Create education groups labels
lab define educ_groups_lab 0 "Less than High School" 1 "High School Degree" 2 "Some College" 3 "Bachelor's Degree" 4 "Advanced Degree"
lab values educ_groups educ_groups_lab

* Create subjective affectedness index
gen aff_myself = roads_m+school_m+comm_m+food_m+evacuation_m+finloss_m+injury_m

* Create subjective household affectedness index 
gen aff_household = roads_h+school_h+comm_h+food_h+evacuation_h+finloss_h+injury_h

* Survey data with weights
svyset [pweight = weight]

* Set covariates
global age="agegr25_44 agegr45_64 agegr65_o"
global edu="highSchoolDegree someCollege bachelor advancedDegree"
*global income="income_4lowermid income_4uppermid income_4high"
global income="income_3med income_3high"

* Two main outcome variables are
* a) Preparedness Investment: prep
d prep
* b) Dam Support: dam_support
d dam_support


**********************************************************************
* Figure 1 (a and b)
**********************************************************************
centile prep if framing==1
label var prep "Preparedness Investment (%)"

histogram prep if framing==1, bin(10) gap(4) percent fcolor(green*.5) lwidth(thin) lcolor(white*.5) ///
ylabel(#10) ///
xlabel(#10) graphregion(fcolor(white) lcolor(white)) legend(off) ///
addplot(pci 0 `r(c_1)' 25 `r(c_1)', lcolor(black) lpattern(dash)) ///
text(-3.5 1  "Source: Bechtel/Mannino, 2021 POBE.", size(vsmall)) 
graph export "$path/Figure1a.pdf", replace

label var dam_support "Dam Support (1=Strongly Oppose, 10=Strongly Support)
gen dam_support_d10=dam_support/10
label var dam_support_d10 "Dam Support (1=Strongly Oppose, 10=Strongly Support)

centile dam_support_d10 if dam_costs==1
histogram dam_support_d10 if dam_costs==1, bin(10) gap(4) percent fcolor(purple*0.5) lcolor(white*0.5) lwidth(thin) ///
ylabel(#10) addplot(pci 0 `r(c_1)' 25 `r(c_1)', lcolor(black) lpattern(dash)) ///
legend(off) ///
text(-3.5 1  "Source: Bechtel/Mannino, 2021 POBE.", size(vsmall)) ///
xlabel(#10) graphregion(fcolor(white) lcolor(white))  
graph export "$path/Figure1b.pdf", replace

graph close


**********************************************************************
* Table 1: Personal Affectedness and Support for Preparedness
**********************************************************************
reg prep paff_3med paff_3high subdrisk_3med subdrisk_3high $income $age $edu female afamerican hisp race_other
outreg2 using "$path/Table1.xls", ctitle("DELETE") excel bdec(2) sdec(2) stats(coef se) replace

foreach y in prep dam_support {
reg `y' paff_3med paff_3high subdrisk_3med subdrisk_3high $income $age $edu female afamerican hisp race_other [pweight = weight], robust
outreg2 using "$path/Table1.xls", ctitle("Affectedness: Exposure and Risk") excel bdec(2) sdec(2) stats(coef se) append

reg `y' obdam3med obdam3high obinj_3med obinj_3high $income $age $edu female afamerican hisp race_other [pweight = weight], robust
outreg2 using "$path/Table1.xls", ctitle("Affectedness: Objective Measures") excel bdec(2) sdec(2) stats(coef se) append

reg `y' patience_3med patience_3high riskacc_3med riskacc_3high ///
republican partyother $income $age $edu female afamerican hisp race_other statefe_* [pweight = weight], robust
outreg2 using "$path/Table1.xls", ctitle("Full with FE") excel bdec(2) sdec(2) stats(coef se) append

reg `y' environ_3med environ_3high ///
respdis_3med respdis_3high trust_3med trust_3high ///
republican partyother $income $age $edu female afamerican hisp race_other [pweight = weight], robust
outreg2 using "$path/Table1.xls", ctitle("Political Factors") excel bdec(2) sdec(2) stats(coef se) append

* Full model with state FE
reg `y' paff_3med paff_3high subdrisk_3med subdrisk_3high ///
patience_3med patience_3high riskacc_3med riskacc_3high ///
environ_3med environ_3high ///
respdis_3med respdis_3high trust_3med trust_3high ///
republican partyother $income $age $edu female afamerican hisp race_other statefe_* [pweight = weight], robust
outreg2 using "$path/Table1.xls", ctitle("Full with FE") excel bdec(2) sdec(2) stats(coef se) append

* Full model with state FE
reg `y' obdam3med obdam3high obinj_3med obinj_3high  ///
patience_3med patience_3high riskacc_3med riskacc_3high ///
environ_3med environ_3high ///
respdis_3med respdis_3high trust_3med trust_3high ///
republican partyother $income $age $edu female afamerican hisp race_other statefe_* [pweight = weight], robust
outreg2 using "$path/Table1.xls", ctitle("Full with FE") excel bdec(2) sdec(2) stats(coef se) append
}

**********************************************************************
* Table 2: The Causal Effects of Policy Features on Preparedness Investment (in \$ Million)
**********************************************************************
reg prep damage_reduction compensation [pweight = weight], robust
outreg2 using "$path/Table2.xls", ctitle("`y'" "Treatment Effects") excel bdec(2) sdec(2) stats(coef se) replace

reg prep damage_reduction compensation $income $age $edu female afamerican hisp race_other [pweight = weight], robust
outreg2 using "$path/Table2.xls", ctitle("`y'" "Sociodemographics") excel bdec(2) sdec(2) stats(coef se) append

reg prep damage_reduction compensation $income $age $edu female afamerican hisp race_other statefe_* [pweight = weight], robust
outreg2 using "$path/Table2.xls", ctitle("`y'" "SDs and State FEs") excel bdec(2) sdec(2) stats(coef se) append


**********************************************************************
* Table 3: The Causal Effects of Construction Costs on Dam Support (in \$ Million)
**********************************************************************
reg dam_support D_damcosts_2m D_damcosts_8m [pweight = weight], robust
outreg2 using "$path/Table3.xls", ctitle("`y'" "Treatment Effects") excel bdec(2) sdec(2) stats(coef se) replace

reg dam_support D_damcosts_2m D_damcosts_8m  $income $age $edu female afamerican hisp race_other [pweight = weight], robust
outreg2 using "$path/Table3.xls", ctitle("`y'" "Sociodemographics") excel bdec(2) sdec(2) stats(coef se) append

reg dam_support D_damcosts_2m D_damcosts_8m  $income $age $edu female afamerican hisp race_other statefe_* [pweight = weight], robust
outreg2 using "$path/Table3.xls", ctitle("`y'" "SDs and State FEs") excel bdec(2) sdec(2) stats(coef se) append


* APPENDIX TABLES

**********************************************************************
* Table A.1: Distribution of Sociodemographics
**********************************************************************

* Raw sample
tab agegroups 
tab educ_groups
tab female

* Weighted sample 
tab agegroups [aweight=weight] 
tab educ_groups [aweight=weight] 
tab female [aweight=weight] 

* Table A.2: Descriptives: Affectedness
*Myself


* Personal
tab aff_myself //not affected = 0
tab roads_m
tab school_m
tab comm_m
tab food_m
tab evacuation_m
tab finloss_m
tab injury_m

* Household
tab aff_household //not affected = 0					
tab roads_h
tab school_h
tab comm_h
tab food_h
tab evacuation_h
tab finloss_h
tab injury_h

**********************************************************************
* Table A.3: Variable Definitions and Descriptives
**********************************************************************
foreach var in riskacc patience trust respdis riskdest environ {
	su `var', det
}

**********************************************************************
* Table A.4: Correlates of Support for Preparedness Investment, Treatment Indicators Included and by Experimental Condition
**********************************************************************
reg prep
outreg2 using "$path/TableA4.xls", ctitle("DELETE") excel bdec(2) sdec(2) stats(coef se) replace

* Outcome: Preparedness Spending: Models 1 to 8 in Table
* Subjective affectedness measures
reg prep paff_3med paff_3high subdrisk_3med subdrisk_3high  ///
patience_3med patience_3high riskacc_3med riskacc_3high ///
environ_3med environ_3high ///
respdis_3med respdis_3high trust_3med trust_3high ///
republican partyother ///
D_frame_prep D_frame_relief ///
$income $age $edu female afamerican hisp race_other statefe_* [pweight = weight], robust
outreg2 using "$path/TableA4.xls", ctitle("Preparedness Investment") excel bdec(2) sdec(2) stats(coef se) append

reg prep paff_3med paff_3high subdrisk_3med subdrisk_3high  ///
patience_3med patience_3high riskacc_3med riskacc_3high ///
environ_3med environ_3high ///
respdis_3med respdis_3high trust_3med trust_3high ///
republican partyother ///
D_frame_prep D_frame_relief ///
$income $age $edu female afamerican hisp race_other statefe_* [pweight = weight] if prepx_cond==0, robust
outreg2 using "$path/TableA4.xls", ctitle("Preparedness Investment: Control") excel bdec(2) sdec(2) stats(coef se) append

reg prep paff_3med paff_3high subdrisk_3med subdrisk_3high  ///
patience_3med patience_3high riskacc_3med riskacc_3high ///
environ_3med environ_3high ///
respdis_3med respdis_3high trust_3med trust_3high ///
republican partyother ///
$income $age $edu female afamerican hisp race_other statefe_* [pweight = weight] if prepx_cond==1, robust
outreg2 using "$path/TableA4.xls", ctitle("Preparedness Investment: Preventive Condition") excel bdec(2) sdec(2) stats(coef se) append

reg prep paff_3med paff_3high subdrisk_3med subdrisk_3high  ///
patience_3med patience_3high riskacc_3med riskacc_3high ///
environ_3med environ_3high ///
respdis_3med respdis_3high trust_3med trust_3high ///
republican partyother ///
$income $age $edu female afamerican hisp race_other statefe_* [pweight = weight] if prepx_cond==2, robust
outreg2 using "$path/TableA4.xls", ctitle("Preparedness Investment: Compensate Condition") excel bdec(2) sdec(2) stats(coef se) append

* Objective affectedness measures
reg prep obinj_3med obinj_3high obdam3med obdam3high ///
patience_3med patience_3high riskacc_3med riskacc_3high ///
environ_3med environ_3high ///
respdis_3med respdis_3high trust_3med trust_3high ///
republican partyother ///
D_frame_prep D_frame_relief ///
$income $age $edu female afamerican hisp race_other statefe_* [pweight = weight], robust
outreg2 using "$path/TableA4.xls", ctitle("Preparedness Investment") excel bdec(2) sdec(2) stats(coef se) append

reg prep obinj_3med obinj_3high obdam3med obdam3high ///
patience_3med patience_3high riskacc_3med riskacc_3high ///
environ_3med environ_3high ///
respdis_3med respdis_3high trust_3med trust_3high ///
republican partyother ///
$income $age $edu female afamerican hisp race_other statefe_* [pweight = weight] if prepx_cond==0, robust
outreg2 using "$path/TableA4.xls", ctitle("Preparedness Investment: Control") excel bdec(2) sdec(2) stats(coef se) append

reg prep obinj_3med obinj_3high obdam3med obdam3high ///
patience_3med patience_3high riskacc_3med riskacc_3high ///
environ_3med environ_3high ///
respdis_3med respdis_3high trust_3med trust_3high ///
republican partyother ///
$income $age $edu female afamerican hisp race_other statefe_* [pweight = weight] if prepx_cond==1, robust
outreg2 using "$path/TableA4.xls", ctitle("Preparedness Investment: Preventive") excel bdec(2) sdec(2) stats(coef se) append

reg prep obinj_3med obinj_3high obdam3med obdam3high ///
patience_3med patience_3high riskacc_3med riskacc_3high ///
environ_3med environ_3high ///
respdis_3med respdis_3high trust_3med trust_3high ///
republican partyother ///
$income $age $edu female afamerican hisp race_other statefe_* [pweight = weight] if prepx_cond==2, robust
outreg2 using "$path/TableA4.xls", ctitle("Preparedness Investment: Compensate") excel bdec(2) sdec(2) stats(coef se) append

* Outcome: Dam Support: Models 9 to 16 in Table
* Subjective affectedness measures
reg dam_support paff_3med paff_3high subdrisk_3med subdrisk_3high ///
patience_3med patience_3high riskacc_3med riskacc_3high ///
environ_3med environ_3high ///
respdis_3med respdis_3high trust_3med trust_3high ///
republican partyother ///
D_damcosts_2m D_damcosts_8m ///
$income $age $edu female afamerican hisp race_other statefe_* [pweight = weight], robust
outreg2 using "$path/TableA4.xls", ctitle("Dam Support") excel bdec(2) sdec(2) stats(coef se) append

reg dam_support paff_3med paff_3high subdrisk_3med subdrisk_3high ///
patience_3med patience_3high riskacc_3med riskacc_3high ///
environ_3med environ_3high ///
respdis_3med respdis_3high trust_3med trust_3high ///
republican partyother ///
$income $age $edu female afamerican hisp race_other statefe_* [pweight = weight] if dam_costs==1, robust
outreg2 using "$path/TableA4.xls", ctitle("Dam Support: Costs: Low ($2m)") excel bdec(2) sdec(2) stats(coef se) append

reg dam_support paff_3med paff_3high subdrisk_3med subdrisk_3high ///
patience_3med patience_3high riskacc_3med riskacc_3high ///
environ_3med environ_3high ///
respdis_3med respdis_3high trust_3med trust_3high ///
republican partyother ///
$income $age $edu female afamerican hisp race_other statefe_* [pweight = weight] if dam_costs==2, robust
outreg2 using "$path/TableA4.xls", ctitle("Dam Support: Costs: Medium ($8m)") excel bdec(2) sdec(2) stats(coef se) append

reg dam_support paff_3med paff_3high subdrisk_3med subdrisk_3high ///
patience_3med patience_3high riskacc_3med riskacc_3high ///
environ_3med environ_3high ///
respdis_3med respdis_3high trust_3med trust_3high ///
republican partyother ///
$income $age $edu female afamerican hisp race_other statefe_* [pweight = weight] if dam_costs==3, robust
outreg2 using "$path/TableA4.xls", ctitle("Dam Support: Costs: High ($14m)") excel bdec(2) sdec(2) stats(coef se) append

* Objective affectedness measures
reg dam_support obinj_3med obinj_3high obdam3med obdam3high ///
patience_3med patience_3high riskacc_3med riskacc_3high ///
environ_3med environ_3high ///
respdis_3med respdis_3high trust_3med trust_3high ///
republican partyother ///
D_damcosts_2m D_damcosts_8m ///
$income $age $edu female afamerican hisp race_other statefe_* [pweight = weight], robust
outreg2 using "$path/TableA4.xls", ctitle("Dam Support") excel bdec(2) sdec(2) stats(coef se) append

reg dam_support obinj_3med obinj_3high obdam3med obdam3high ///
patience_3med patience_3high riskacc_3med riskacc_3high ///
environ_3med environ_3high ///
respdis_3med respdis_3high trust_3med trust_3high ///
republican partyother ///
$income $age $edu female afamerican hisp race_other statefe_* [pweight = weight] if dam_costs==1, robust
outreg2 using "$path/TableA4.xls", ctitle("Dam Support: Costs: Low ($2m)") excel bdec(2) sdec(2) stats(coef se) append

reg dam_support obinj_3med obinj_3high obdam3med obdam3high ///
patience_3med patience_3high riskacc_3med riskacc_3high ///
environ_3med environ_3high ///
respdis_3med respdis_3high trust_3med trust_3high ///
republican partyother ///
$income $age $edu female afamerican hisp race_other statefe_* [pweight = weight] if dam_costs==2, robust
outreg2 using "$path/TableA4.xls", ctitle("Dam Support: Costs: Medium ($8m)") excel bdec(2) sdec(2) stats(coef se) append

reg dam_support obinj_3med obinj_3high obdam3med obdam3high ///
patience_3med patience_3high riskacc_3med riskacc_3high ///
environ_3med environ_3high ///
respdis_3med respdis_3high trust_3med trust_3high ///
republican partyother ///
$income $age $edu female afamerican hisp race_other statefe_* [pweight = weight] if dam_costs==3, robust
outreg2 using "$path/TableA4.xls", ctitle("Dam Support: Costs: High ($14m)") excel bdec(2) sdec(2) stats(coef se) append

**********************************************************************
* Table A.5: The Correlates of Support for Disaster Preparedness Investment, Binary Affectedness Indicator
**********************************************************************
reg prep
outreg2 using "$path/TableA5.xls", ctitle("DELETE") excel bdec(2) sdec(2) stats(coef se) replace

* Binary affectedness measure
reg prep aff_some subdrisk_3med subdrisk_3high ///
patience_3med patience_3high riskacc_3med riskacc_3high ///
environ_3med environ_3high ///
respdis_3med respdis_3high trust_3med trust_3high ///
republican partyother ///
D_frame_prep D_frame_relief ///
$income $age $edu female afamerican hisp race_other statefe_* [pweight = weight], robust
outreg2 using "$path/TableA5.xls", ctitle("Preparedness Investment") excel bdec(2) sdec(2) stats(coef se) append

reg dam_support aff_some subdrisk_3med subdrisk_3high ///
patience_3med patience_3high riskacc_3med riskacc_3high ///
environ_3med environ_3high ///
respdis_3med respdis_3high trust_3med trust_3high ///
republican partyother ///
D_frame_prep D_frame_relief ///
$income $age $edu female afamerican hisp race_other statefe_* [pweight = weight], robust
outreg2 using "$path/TableA5.xls", ctitle("Dam Support") excel bdec(2) sdec(2)stats(coef se) append

**********************************************************************
* Table A.6: The Correlates of Support for Disaster Preparedness Investment, Tobit Estimates
**********************************************************************
tobit prep paff_3med paff_3high subdrisk_3med subdrisk_3high ///
patience_3med patience_3high riskacc_3med riskacc_3high ///
environ_3med environ_3high ///
respdis_3med respdis_3high trust_3med trust_3high ///
republican partyother $income $age $edu female afamerican hisp race_other statefe_* [pweight = weight], vce(robust) ll(0) ul(100)
outreg2 using "$path/TableA6.xls", ctitle("DELETE") excel bdec(2) sdec(2) stats(coef se) replace

* Need to loop separately for prep and dam
* Preparedness spending
foreach y in prep {
tobit `y' paff_3med paff_3high subdrisk_3med subdrisk_3high $income $age $edu female afamerican hisp race_other [pweight = weight], vce(robust) ll(0) ul(100)
outreg2 using "$path/TableA6.xls", ctitle("Affectedness: Exposure and Risk") excel bdec(2) sdec(2) stats(coef se) append

tobit `y' obinj_3med obinj_3high obdam3med obdam3high $income $age $edu female afamerican hisp race_other [pweight = weight], vce(robust) ll(0) ul(100)
outreg2 using "$path/TableA6.xls", ctitle("Affectedness: Objective Measures") excel bdec(2) sdec(2) stats(coef se) append

tobit `y' patience_3med patience_3high riskacc_3med riskacc_3high ///
republican partyother $income $age $edu female afamerican hisp race_other statefe_* [pweight = weight], vce(robust) ll(0) ul(100)
outreg2 using "$path/TableA6.xls", ctitle("Full with FE") excel bdec(2) sdec(2) stats(coef se) append

tobit `y' environ_3med environ_3high ///
respdis_3med respdis_3high trust_3med trust_3high ///
republican partyother $income $age $edu female afamerican hisp race_other [pweight = weight], vce(robust) ll(0) ul(100)
outreg2 using "$path/TableA6.xls", ctitle("Political Factors") excel bdec(2) sdec(2) stats(coef se) append

* Full model with state FE
tobit `y' paff_3med paff_3high subdrisk_3med subdrisk_3high ///
patience_3med patience_3high riskacc_3med riskacc_3high ///
environ_3med environ_3high ///
respdis_3med respdis_3high trust_3med trust_3high ///
republican partyother $income $age $edu female afamerican hisp race_other statefe_* [pweight = weight], vce(robust) ll(0) ul(100)
outreg2 using "$path/TableA6.xls", ctitle("Full with FE") excel bdec(2) sdec(2) stats(coef se) append

* Full model with state FE
tobit `y' obinj_3med obinj_3high obdam3med obdam3high ///
patience_3med patience_3high riskacc_3med riskacc_3high ///
environ_3med environ_3high ///
respdis_3med respdis_3high trust_3med trust_3high ///
republican partyother $income $age $edu female afamerican hisp race_other statefe_* [pweight = weight], vce(robust) ll(0) ul(100)
outreg2 using "$path/TableA6.xls", ctitle("Full with FE") excel bdec(2) sdec(2) stats(coef se) append
}

* Dam support 
foreach y in dam_support {
tobit `y' paff_3med paff_3high subdrisk_3med subdrisk_3high $income $age $edu female afamerican hisp race_other [pweight = weight], vce(robust) ll(10) ul(100)
outreg2 using "$path/TableA6.xls", ctitle("Affectedness: Exposure and Risk") excel bdec(2) sdec(2) stats(coef se) append

tobit `y' obinj_3med obinj_3high obdam3med obdam3high $income $age $edu female afamerican hisp race_other [pweight = weight], vce(robust) ll(10) ul(100)
outreg2 using "$path/TableA6.xls", ctitle("Affectedness: Objective Measures") excel bdec(2) sdec(2) stats(coef se) append

tobit `y' patience_3med patience_3high riskacc_3med riskacc_3high ///
republican partyother $income $age $edu female afamerican hisp race_other statefe_* [pweight = weight], vce(robust) ll(10) ul(100)
outreg2 using "$path/TableA6.xls", ctitle("Full with FE") excel bdec(2) sdec(2) stats(coef se) append

tobit `y' environ_3med environ_3high ///
respdis_3med respdis_3high trust_3med trust_3high ///
republican partyother $income $age $edu female afamerican hisp race_other [pweight = weight], vce(robust) ll(10) ul(100)
outreg2 using "$path/TableA6.xls", ctitle("Political Factors") excel bdec(2) sdec(2) stats(coef se) append

* Full model with state FE
tobit `y' paff_3med paff_3high subdrisk_3med subdrisk_3high ///
patience_3med patience_3high riskacc_3med riskacc_3high ///
environ_3med environ_3high ///
respdis_3med respdis_3high trust_3med trust_3high ///
republican partyother $income $age $edu female afamerican hisp race_other statefe_* [pweight = weight], vce(robust) ll(10) ul(100)
outreg2 using "$path/TableA6.xls", ctitle("Full with FE") excel bdec(2) sdec(2) stats(coef se) append

* Full model with state FE
tobit `y' obinj_3med obinj_3high obdam3med obdam3high ///
patience_3med patience_3high riskacc_3med riskacc_3high ///
environ_3med environ_3high ///
respdis_3med respdis_3high trust_3med trust_3high ///
republican partyother $income $age $edu female afamerican hisp race_other statefe_* [pweight = weight], vce(robust) ll(10) ul(100)
outreg2 using "$path/TableA6.xls", ctitle("Full with FE") excel bdec(2) sdec(2) stats(coef se) append
}

log close
clear
exit
